package com.jiazhong.a.b.c;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/m/n/q/servlet2")//相对路径
public class Servlet2 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //请求转发 绝对路径的写法
        //final RequestDispatcher requestDispatcher = req.getRequestDispatcher("../../../m/n/q/test02.html");
        //绝对路径
        final RequestDispatcher requestDispatcher = req.getRequestDispatcher("/m/n/q/test02.html");
        requestDispatcher.forward(req,resp);
    }
}
